package domain;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class DomainUtil {

	public static List<Census2010> convertCensus2010(ResultSet rs){
		List<Census2010> ret = new ArrayList<Census2010>();
		try {
			while (rs.next()){
				Census2010 toAdd = new Census2010();
				toAdd.setName(rs.getString(1));
				toAdd.setType(rs.getString(2));
				toAdd.setPopulation(rs.getString(3));
				toAdd.setPercentUnder18(rs.getString(4));
				toAdd.setPercent18to24(rs.getString(5));
				toAdd.setPercent25to44(rs.getString(6));
				toAdd.setPercent45to64(rs.getString(7));
				toAdd.setPercentOver65(rs.getString(8));
				ret.add(toAdd);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return ret;
	}
}
